limit
$limit
Limits the number of documents to pass to the next stage in the pipeline.
Note: You can use the limit method for pagination.
Syntax
{ "$limit": number }
Sample Request
[
{
"$match": {
"temp": {
"$exists": true
}
}
},
{
"$limit":3
}
]
Sample Response
{
"_list": [
{
"temp": 10,
"_tsMetadata": {
"_sourceId": "4b78c28b-7af6-406f-9265-b120c7141b13"
},
"_id": "645bcb5cf8b8a87c0f075cf7",
"_ts": "Wed May 10 22:20:35 IST 2023"
},
{
"temp": 12,
"_tsMetadata": {
"_sourceId": "4b78c28b-7af6-406f-9265-b120c7141b13"
},
"_id": "645bcb5cf8b8a87c0f075d00",
"_ts": "Wed May 10 22:20:36 IST 2023"
},
{
"temp": 11,
"_tsMetadata": {
"_sourceId": "0dda42b7-831b-47d2-aa83-c65edd3c5113"
},
"_id": "645bcb5cf8b8a87c0f075cf8",
"_ts": "Wed May 10 22:20:36 IST 2023"
}
]
}